#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const ll N = 3e5 + 10;
const ull P = 131;

ll n;
ull f[N];
set<ull> st;
ull pw[N];

void solve()
{
    pw[0] = 1;
    for (ll i = 1;i < N;i++) pw[i] = pw[i - 1] * P;

    cin >> n;
    for (ll i = 1;i <= n;i++) {
        string s;cin >> s;ll len = s.size(); s = " " + s;
        for (ll j = 1;j <= len;j++)
            f[j] = f[j - 1] * P + s[j] - 'a' + 1;

        for (ll j = 1;j <= len;j++) {
            ull t = f[len] - f[j - 1] * pw[len - j + 1];
            st.insert(t);
        }
    }
    cout << st.size();
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll T = 1;
    //cin>>T;
    for (ll i = 1;i <= T;i++) {
        solve();
    }
}